# CSS background-repeat Property

## Example

Repeat a background-image only vertically:

body {
background-image: url("paper.gif");
background-repeat: repeat-y;
}
Try it yourself »

More "Try it Yourself" examples below.

## Definition and Usage

The background-repeat property sets if/how a background image will be repeated.

By default, a background-image is repeated both vertically and horizontally.

Tip: The background image is placed according to the background-position property. If no background-position is specified, the image is always placed at the element's top left corner.

Default value: | repeat
Inherited: | no
Animatable: | no. Read about animatable
Version: | CSS1
JavaScript syntax: | object.style.backgroundRepeat="repeat-x" Try it

## Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property |  |  |  |  |
--- | --- | --- | --- | --- | ---
background-repeat | 1.0 | 4.0 | 1.0 | 1.0 | 3.5

Note: IE8 and earlier do not support multiple background images on one element.

## CSS Syntax

background-repeat: repeat|repeat-x|repeat-y|no-repeat|initial|inherit;

## Property Values

Value | Description | Play it
--- | --- | ---
repeat | The background image will be repeated both vertically and horizontally. This is default | Play it »
repeat-x | The background image will be repeated only horizontally | Play it »
repeat-y | The background image will be repeated only vertically | Play it »
no-repeat | The background-image will not be repeated | Play it »
initial | Sets this property to its default value. Read about initial | Play it »
inherit | Inherits this property from its parent element. Read about inherit |

## More Examples

## Example

How to repeat a background image both vertically and horizontally (default for background images):

body {
background-image: url("paper.gif");
}
Try it yourself »

## Example

Repeat a background image only horizontally:

body {
background-image: url("paper.gif");
background-repeat: repeat-x;
}
Try it yourself »

## Example

Display a background image only one time, with no-repeat:

body {
background-image: url("paper.gif");
background-repeat: no-repeat;
}
Try it yourself »

## Related Pages

CSS tutorial: CSS Background

CSS reference: background-position property

HTML DOM reference: backgroundRepeat property

### WEB HOSTING

UK Reseller Hosting

### WEB BUILDING

FREE Website BUILDER Free HTML5 Templates

### W3SCHOOLS EXAMS

HTML, CSS, JavaScript, PHP, jQuery, XML, and ASP Certifications

### SHARE THIS PAGE

### Color Picker

### HTML/CSS

HTML Tutorial HTML5 Tutorial CSS Tutorial CSS3 Tutorial Bootstrap Tutorial

### JavaScript

JavaScript Tutorial jQuery Tutorial jQuery Mobile Tutorial AngularJS Tutorial AJAX Tutorial JSON Tutorial

### Graphics

Canvas Tutorial SVG Tutorial Google Maps Tutorial

### Server Side

SQL Tutorial PHP Tutorial ASP Tutorial ASP.NET Tutorial VBScript Tutorial AppML Tutorial

### Web

Web Building Web Statistics Web Certification

### XML

XML Tutorial DTD Tutorial Schema Tutorial XML DOM Tutorial XPath Tutorial XSLT Tutorial XQuery Tutorial XSL-FO Tutorial RSS Tutorial WSDL Tutorial

### HTML/CSS

HTML Tag Reference HTML Event Reference HTML Color Reference CSS 1,2,3 Reference Bootstrap Reference

### JavaScript

JavaScript Reference HTML DOM Reference jQuery Reference jQuery Mobile Reference Google Maps Reference

### Server Side

PHP Reference SQL Reference ASP Reference VBScript Reference Razor Reference ASP.NET Reference

### XML

XML DOM Reference XSLT Reference XSL-FO Reference XPath Reference XQuery Reference Schema Reference RSS Reference SVG Reference

### HTML Charsets

HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 HTML Symbols HTML UTF-8

### HTML/CSS

HTML Examples CSS Examples

### Browser Scripting

JavaScript Examples HTML DOM Examples jQuery Examples jQuery Mobile Examples AngularJS Examples AJAX Examples

### Server Scripting

PHP Examples ASP Examples VBScript Examples Razor Examples .NET Examples

### XML Languages

XML Examples DTD Examples XML DOM Examples XSL Examples XSLT Examples XPath Examples XQuery Examples Schema Examples RSS Examples SVG Examples